package com.codesniper.holderapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

public class SecondActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_activity);
    }

    public void main(View view){
        Intent intent = new Intent(SecondActivity.this, MainActivity.class);//启动 NotificationActivity 活动
        //Intent.FLAG_ACTIVITY_CLEAR_TOP
        // 销毁目标Activity和它之上的所有Activity，重新创建目标Activity
//        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        // 与加载模式singleTop功能相同
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}
